<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="p" uri="/WEB-INF/pagination.tld" %>
<html>
<head><title>Document</title></head>
<SCRIPT type="text/javascript">
		function selectAll(){	
			var _cb = document.getElementById('select_all');
			var checkboxes = document.getElementsByTagName("input");
			for(var i=0; i<checkboxes.length; i++){
				var checkbox = checkboxes[i];
				if(checkbox.id != 'select_all' && checkbox.type == 'checkbox'){
				 	checkbox.checked = _cb.checked;
				}
			}
		}
		function viewDocuments(){
			var filenames = "";
			var checkboxes = document.getElementsByTagName("input");
			var aflag = true;
			var String
			for(var i=0; i<checkboxes.length; i++){
				var checkbox = checkboxes[i];
				if(checkbox.id != 'select_all' && checkbox.type == 'checkbox'){
				 	if(checkbox.checked == true){
				 		if(aflag == true){
				 			filenames =  checkbox.id;
				 		}else{
				 			filenames = filenames + "#spliter#" + checkbox.id;
				 		}
				 		aflag = false;
				 		
				 	}
				}//		alert(filenames);
			}
			//alert(filenames);
			if(aflag){
				alert("Please Select Document!");
			}else{
				var form = document.createElement('form');
				form.setAttribute('method','post');
				form.setAttribute('action','viewDocument.action');
				var input = document.createElement('input');
				input.setAttribute('type','hidden');
				input.setAttribute('name','filenames');
				input.setAttribute('value',filenames);
				
				form.appendChild(input);
				document.body.appendChild(form);
				form.submit();
			}
		}
		function signDocument(){
			var filenames = "";
			var checkboxes = document.getElementsByTagName("input");
			var aflag = true;
			var String
			for(var i=0; i<checkboxes.length; i++){
				var checkbox = checkboxes[i];
				if(checkbox.id != 'select_all' && checkbox.type == 'checkbox'){
				 	if(checkbox.checked == true){
				 		if(aflag == true){
				 			filenames =  checkbox.id;
				 		}else{
				 			filenames = filenames + "#spliter#" + checkbox.id;
				 		}
				 		aflag = false;
				 		
				 	}
				}
			}
			
			if(aflag){
				alert("Please Select Document!");
			}else{
				var form = document.createElement('form');
				form.setAttribute('method','post');
				form.setAttribute('action','signDocument.action');
				var input = document.createElement('input');
				input.setAttribute('type','hidden');
				input.setAttribute('name','filenames');
				input.setAttribute('value',filenames);
				form.appendChild(input);
				document.body.appendChild(form);
				form.submit();
			}
		}
		
		function signSelectedDocument(){		
		document.unSignDocumentEdit.submit();
		
		}
	</SCRIPT>
	<style type="text/css">
	<!--
	body {
		margin-left: 0px;
		margin-top: 0px;
		margin-right: 0px;
		margin-bottom: 0px;
		background-color: #EEF2FB;
	}
	-->
	</style>
	<link href="../images/skin.css" rel="stylesheet" type="text/css" />
<body>
→List Patient Documents→
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td>
			 <table width="100%" border="0" cellpadding="0" cellspacing="0">
			 	<tr>
			 		<td width="17" valign="top" background="../images/mail_leftbg.gif"><img src="../images/left-top-right.gif" width="17" height="29" /></td>
				    <td valign="top" background="../images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
				      <tr>
				      <td>
    					<input type="button" value="Print Selected" onclick="javascript:printSelectedDocument();"/>
    				  </td>
				      </tr>
				    </table></td>
				    <td width="16" valign="top" background="../images/mail_rightbg.gif"><img src="../images/nav-right-bg.gif" width="16" height="29" /></td>
			 	</tr>
			 </table>
			</td>    
		</tr>
		<tr>
			<td>
				<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F7F8F9">
						<thead>
							<tr>
								<th width="17" background="../images/mail_leftbg.gif"><img src="../images/mail_leftbg.gif" width="17" height="17" /></th>
								<th align=left>	
									 <input id="select_all" type="checkbox" onclick="selectAll();">
								</th>
								<th align="left">
									Patient Name
								</th>
								<th align="left">
									Doctor Name
								</th>
								<th align="left"> 
									Creation Time
								</th>
							    <th align="left"> 
									Received Time
							    </th>

								<th width="16" background="../images/mail_rightbg.gif"><img src="../images/mail_rightbg.gif" width="16" height="17" /></th>
							</tr>
						</thead>
						<tbody>
							<s:iterator value="documents" status="st">
								<s:if test="#st.Odd">
									<tr bgcolor="#dde9f5">													
								</s:if>
								<s:else>
									<tr>					
								</s:else>
									<td width="17" background="../images/mail_leftbg.gif"><img src="../images/mail_leftbg.gif" width="17" height="17" /></td>
									<td align="left">
										<input id="<s:property value="id" />" type="CheckBox">
									</td>
									<td align="left">
										<a href="../document/showSignedDocumentFirst.action?id=<s:property value='id'/>"><s:property value="patient" /></a>
									</td>
									<td align="left">
										<s:property value="detailUserByUserId.familyName" />
									</td>
									<td align="left">
										<s:property value="createTime" />
									</td>
								 <td align="left">
								      <s:property value="operateTime" />										
									</td>	
									<td width="16" background="../images/mail_rightbg.gif"><img src="../images/mail_rightbg.gif" width="16" height="17" /></td>									 
								</tr>
							</s:iterator>
							<tr align="left">
								<td width="17" background="../images/mail_leftbg.gif"><img src="../images/mail_leftbg.gif" width="17" height="17" /></td>
								<td colspan="5">
								
									<p:pagination pageIndex="${pageIndex}" actionName="listPatientDocument.action?" pageCount="${pageCount}" parameters="caseNumber=${caseNumber}&"></p:pagination>
								
								</td>
								<td width="16" background="../images/mail_rightbg.gif"><img src="../images/mail_rightbg.gif" width="16" height="17" /></td>
							</tr>

						</tbody>
					</table>
			</td>
		</tr>
		<tr>
			<td>
			 <table width="100%" border="0" cellpadding="0" cellspacing="0">
			 	<tr>
			 		<td width="17" valign="top" background="../images/mail_leftbg.gif"><img src="../images/buttom_left2.gif" width="17" height="17" /></td>
				    <td valign="top" background="../images/buttom_bgs.gif"><img src="../images/buttom_bgs.gif" width="17" height="17"></td>
				    <td width="16" valign="top" background="../images/mail_rightbg.gif"><img src="../images/buttom_right2.gif" width="16" height="17" /></td>
			 	</tr>
			 </table>
			</td>    
		</tr>
	</table>
</body>
</html>
